<%@page import="controller.Utils"%>
<%@page import="models.Domain"%>
<%@page import="java.util.Date"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.text.NumberFormat"%>
<%
String strs = (String) request.getAttribute("strs");
String name = (String) request.getAttribute("name");
Domain domain = (Domain) request.getAttribute("domain");
	
Date date = new Date();
Date dates = new Date();
if(domain.getDate() != null)
{
	dates = domain.getDate();
}
long seconds = (date.getTime() - dates.getTime())/1000;
long day = (int) (seconds / 86400);
long hour = (int) ((seconds - day*86400) / 3600);
long minute = (int) ((seconds - day*86400 - hour*3600) / 60);


NumberFormat nf = NumberFormat.getInstance();
String title = domain.getDomain();
String description = domain.getDomain();
String keyword = domain.getDomain();
if(domain.getTitle()!=null)
{
	title +=" - "+domain.getTitle(); 	
}
if(domain.getDescription()!=null)
{
	description +=" - "+domain.getDescription().getValue(); 	
}
if(domain.getKeywords()!=null)
{
	keyword +=","+domain.getKeywords().getValue(); 	
}
if(description.length()<70&&domain.getDes()!=null)
{
	description+=domain.getDes().getValue();
}
if(description.length()<40)
	description+=",here you can find full information about "+domain.getDomain()+" as whois,ip,backlink";
if(description.length()>250)
	description=description.substring(0,240);
if(keyword.length()>250)
	keyword=keyword.substring(0,240);

String names = domain.getDomain();
%>
<%
	request.setCharacterEncoding("utf-8");
%>
<%@page contentType="text/html;charset=UTF-8" language="java"%>
<jsp:include page="./layout/header.jsp">
	<jsp:param name="title" value="<%=title %>"/>
	<jsp:param name="description" value="<%=description %>"/>
	<jsp:param name="keywords" value="<%=keyword %>"/>
	<jsp:param name="img" value="<%=names %>"/>
</jsp:include>
		<div class="body">
			<div class="body_left">
				<div class="top_left">
					<%@ include file='/adv/left.jsp'%>
				</div>
				<h2>Other domain</h2>
				<ul class="left_list">
				<%
					String[] oth = domain.getOtherDomain().split(",");
					for(int i=0;i<oth.length;i++)
					{
				%>
					<li><a href="/d/<%=oth[i]%>"><%=oth[i]%></a></li>
				<%
					}	
				%>
				</ul>
				<div class="de_adv">
					<%@ include file='/adv/left160.jsp'%>
				</div>
			</div>
			<div class="body_right">
				<div class="top">
					<div class="d_name">
					<img src='http://chart.apis.google.com/chart?chs=60x60&cht=qr&chld=|0&chl=http://<%=domain.getDomain() %>'/>
					<a href="/sl/<%=domain.getDomain() %>"><%=domain.getDomain() %></a>
					</div>
				</div>
				<div class="content">
					<div class="note clear">
					Updated<b>
					<%
						if(day > 0)
						{
							out.print(day+" days, ");
						}
						if(hour > 0)
						{
							out.print(hour+" hours, ");
						}
						out.print(minute+" minutes");
					%>	
					</b> Ago
					<%
					if(day>=7 || domain.getDate() == null)
					{
					%>
								<strong class="size">( <a href="javascript:void(0)" rel="nofollow" id="update">Update</a> )</strong>
					<%
					}
					%>
					</div>
					
					<div class="adv">
						<%@ include file='/adv/left.jsp'%>
					</div>
					<div class="list">
						<h1>Ranking info of <%=domain.getDomain() %></h1>
						<ul class="detail">
							<li>
								<div class="left w_left">
									Google pagerank :
								</div>
								<div class="right w_right">
									<%=(domain.getGooglepr()!=null)?domain.getGooglepr():"-" %>
								</div>
							</li>
							<li>
								<div class="left w_left">
									Alexa rank :
								</div>
								<div class="right w_right">
									<%=domain.getAlexa()!=0?nf.format(domain.getAlexa()):"-" %>
								</div>
							</li>
						</ul>
						<div class="clear"></div>
						<h1 class="m_top">Domain</h1>
						<ul class="detail">
							<li>
								<div class="left w_left">
									Domain name :
								</div>
								<div class="right w_right">
									<strong><%=domain.getDomain()%></strong><br/>
									<strong>Length : </strong> <%=Utils.checkLengthDomain(domain.getDomain()) %> characters
								</div>
							</li>
							<li>
								<div class="left w_left">
									Subdomain :
								</div>
								<div class="right w_right">
									<strong><%=domain.getDomain()%></strong> <%=Utils.returnSubDomain(domain.getDomain()) %>
								</div>
							</li>
							<li>
								<div class="left w_left">
									Favicon :
								</div>
								<div class="right w_right">
									<img src="https://s2.googleusercontent.com/s2/favicons?domain_url=http://<%=domain.getDomain()%>"/>
								</div>
							</li>
						</ul>
					</div>
					<div class="clear"></div>
					<div class="adv_menu">
						<%@ include file='/adv/menu.jsp'%>
					</div>
					<div class="adv right">
						<%@ include file='/adv/left.jsp'%>
					</div>
					<div class="list margin_3">
						<h1>Site parameters of <%=domain.getDomain() %></h1>
						<ul class="detail">
							<li>
								<div class="left w_left">
									Estimate Visitor per Day :
								</div>
								<div class="right w_right">
									<%=(domain.getVisit()!=null && !domain.getVisit().equals("-"))?nf.format(Math.ceil(((350*Float.parseFloat(domain.getVisit().replaceAll("[^0-9.]","")))*80)/0.03))+" - "+nf.format(Math.ceil(((350*Float.parseFloat(domain.getVisit().replaceAll("[^0-9.]","")))*120)/0.03)):"-" %>
								</div>
							</li>
							<li>
								<div class="left w_left">
									Speed site :
								</div>
								<div class="right w_right">
									<%=(domain.getSpeed()!=null)?domain.getSpeed()+" Seconds":"-" %>
								</div>
							</li>
							<li>
								<div class="left w_left">
									Domain Age :
								</div>
								<div class="right w_right">
									<%=(domain.getAge()!=null)?domain.getAge():"-" %>
								</div>
							</li>
							<li>
								<div class="left w_left">
									Charset :
								</div>
								<div class="right w_right">
									<%=(domain.getCharset()!=null)?domain.getCharset():"-" %>
								</div>
							</li>
							<li>
								<div class="left w_left">
									WOT :
								</div>
								<div class="right w_right">
									<%=(domain.getWot()!=null)?domain.getWot():"-" %>
								</div>
							</li>
							<li>
								<div class="left w_left">
									Page speed :
								</div>
								<div class="right w_right" id='page_speed'>
									<a href="javascript:void(0)" onclick="runPagespeed()">Check now</a>
								</div>
							</li>
						</ul>
					</div>
					<div class="clear"></div>
					<div class="adv_menu">
						<%@ include file='/adv/menu.jsp'%>
					</div>
					
					<div class="list re_list">
						<h1 class="m_top">Site info of <%=domain.getDomain() %></h1>
						<ul class="detail">
							<li>
								<div class="left w_left">
									Other domain :
								</div>
								<div class="right d_right">
									<a href="/sd/<%=Utils.returnSubDomainTo(domain.getDomain())%>"><%=Utils.returnSubDomainTo(domain.getDomain())%></a>
								</div>
							</li>
							<li>
								<div class="left w_left">
									Title :
								</div>
								<div class="right d_right">
									<%=(domain.getTitle()!=null)?domain.getTitle():"-" %><br/>
									<strong>Length : <%=(domain.getTitle()!=null)?domain.getTitle().length():"0" %></strong>  characters
								</div>
							</li>
							<li>
								<div class="left w_left">
									Keywords :
								</div>
								<div class="right d_right">
									<%
									int jk = 0;
									if(domain.getKeywords()!=null)
									{
										String[] arrayList = domain.getKeywords().getValue().split(",");
										for(int i=0;i<arrayList.length;i++)
										{
											jk++;
									%>
											<a href="/t/<%=arrayList[i].trim() %>"><%=arrayList[i].trim() %></a> | 
									<%
										}
									}
									%>
									<br/>
									<strong>Length : <%=(domain.getKeywords()!=null)?Utils.returnLength(domain.getKeywords().getValue()):"0" %></strong>  characters<br/>
									<strong>Number : <%=jk %></strong>  keywords
								</div>
							</li>
							<li>
								<div class="left w_left">
									Popular Keywords :
								</div>
								<div class="right d_right">
									<%
									if(domain.getPopularKeyword()!=null)
									{
										String[] arrayList = domain.getPopularKeyword().getValue().split(",");
										for(int i=0;i<arrayList.length;i++)
										{
									%>
											<a href="/t/<%=arrayList[i].trim() %>"><%=arrayList[i].trim() %></a> | 
									<%
										}
									}
									%>
								</div>
							</li>
							<li>
								<div class="left w_left">
									Description :
								</div>
								<div class="right d_right">
									<%=(domain.getDes()!=null)?domain.getDes().getValue():"-" %><br/>
									<strong>Length : <%=(domain.getDes()!=null)?domain.getDes().getValue().length():"0" %></strong>  characters
								</div>
							</li>
						</ul>
					</div>
					<div class="list re_list">
						<h1 class="m_top">Site contact info of <%=domain.getDomain() %></h1>
						<ul class="detail">
							<li>
								<div class="left w_left">
									Google Analytic :<br/>
								</div>
								<div class="right d_right">
									<%=(domain.getGoogleAnalytic()!=null)?domain.getGoogleAnalytic():"-" %>
								</div>
							</li>
							<li>
								<div class="left w_left">
									Google Adsense  :<br/>
								</div>
								<div class="right d_right">
									<%=(domain.getGoogleAdsense()!=null)?domain.getGoogleAdsense():"-" %>
								</div>
							</li>
						</ul>
					</div>
					<div class="list re_list">
						<h1 class="m_top">Site Technical Info of <%=domain.getDomain() %></h1>
						<ul class="detail">
							<li>
								<div class="left w_left">
									Programming Language :
								</div>
								<div class="right d_right">
									<%=(domain.getLanguage()!=null)?domain.getLanguage():"-" %>
								</div>
							</li>
							<li>
								<div class="left w_left">
									Web server :
								</div>
								<div class="right d_right">
									<%=(domain.getServer()!=null)?domain.getServer():"-" %>
								</div>
							</li>
							<li>
								<div class="left w_left">
									Javascript library  :
								</div>
								<div class="right d_right">
									<%=(domain.getJavascript()!=null)?Utils.returnString(domain.getJavascript(),""):"-" %>
								</div>
							</li>
							<li>
								<div class="left w_left">
									IP Address  :<br/>
								</div>
								<div class="right d_right">
									<%=(domain.getIp()!=null)?"<a href='/i/"+domain.getIp()+"'>"+domain.getIp()+"</a>":"-" %>
								</div>
							</li>
						</ul>
					</div>
					<%
					if(domain.getIp()!=null)
					{
					%>
					<div class="list re_list">
						<h1 class="m_top">Whois ip <a style='color:#0033CC;font-size: 20px;' href='/i/<%=domain.getIp() %>'><%=domain.getIp() %></a></h1>
						<ul class="detail">
							<li class="whois">
								<%=(domain.getWhoisIp()!=null)?Utils.returnWhois(domain.getWhoisIp().getValue()):"" %>
							</li>
						</ul>
					</div>
					<%
					}
					%>
					<div class="list re_list">
						<h1 class="m_top">Whois <%=domain.getDomain() %> ( <a href="/w/<%=domain.getDomain()%>">More detail ...</a> )</h1>
						<ul class="detail">
							<li class="whois">
								<%=(domain.getWhois()!=null)?Utils.returnWhois(domain.getWhois().getValue()):"" %>
							</li>
						</ul>
					</div>
					<div class="list re_list">
						<h1 class="m_top">DNS Record <%=domain.getDomain() %></h1>
						<ul class="detail">
							<li class="whois">
								<%=(domain.getDsn()!=null)?domain.getDsn().getValue():"" %>
							</li>
						</ul>
					</div>
					<div class="list re_list">
						<h1 class="m_top">NSLOOKUP <%=domain.getDomain() %></h1>
						<ul class="detail">
							<li class="whois">
								<%=(domain.getNs()!=null)?domain.getNs().getValue():"" %>
							</li>
						</ul>
					</div>
					<div class="list re_list">
						<h1 class="m_top">Site Seo of <%=domain.getDomain() %></h1>
						<ul class="detail">
							<li>
								<div class="left w_left">
									Tag :
								</div>
								<div class="right d_right">
									<table cellpadding="0" cellspacing="0" class="l_tag">
										<tr>
											<th>H1</th>
											<th>H2</th>
											<th>H3</th>
											<th>H4</th>
											<th>H5</th>
										</tr>
										<tr>
											<th><%=(domain.getH1()!=0)?domain.getH1():"0" %></th>
											<th><%=(domain.getH2()!=0)?domain.getH2():"0" %></th>
											<th><%=(domain.getH3()!=0)?domain.getH3():"0" %></th>
											<th><%=(domain.getH4()!=0)?domain.getH4():"0" %></th>
											<th><%=(domain.getH5()!=0)?domain.getH5():"0" %></th>
										</tr>
									</table>
								</div>
							</li>
							<li>
								<div class="left w_left">
									Image :
								</div>
								<div class="right d_right">
									We found <b><%=(domain.getImg()!=0)?domain.getImg():"-" %></b> images on this website.
									<%=(domain.getImgAlt()!=0)?"<br/>There are <b>"+domain.getImgAlt()+" </b>images alt attribute":"-" %>
								</div>
							</li>
							<li>
								<div class="left w_left">
									Frame  :
								</div>
								<div class="right d_right">
									<b><%=(domain.getFrame()!=0)?domain.getFrame():"No" %></b> 
								</div>
							</li>
							<li>
								<div class="left w_left">
									Flash  :
								</div>
								<div class="right d_right">
									<b><%=(domain.getFlash()!=0)?domain.getFlash():"No" %></b> 
								</div>
							</li>
							<li>
								<div class="left w_left">
									Size  :
								</div>
								<div class="right d_right">
									<b><%=(domain.getSize()!=null)?nf.format(Integer.parseInt(domain.getSize()))+" characters":"-" %></b>
								</div>
							</li>	
							<li>
								<div class="left w_left">
									Meta Description  :
								</div>
								<div class="right d_right">
									<b><%=domain.getCheckDes()!=0?"Yes":"No" %></b>
								</div>
							</li>
							<li>
								<div class="left w_left">
									Meta Keyword  :
								</div>
								<div class="right d_right">
									<b><%=domain.getCheckKey()!=0?"Yes":"No" %></b>
								</div>
							</li>
						</ul>
					</div>
					<div class="list re_list">
						<h1 class="m_top">Cross link of <%=domain.getDomain() %></h1>
						<ul class="detail">
							<li>
								<div class="left w_left">
									Out link :
								</div>
								<%
									String[] arr=null;
									if(domain.getOutLink()!=null&&!domain.getOutLink().getValue().trim().equals(""))
									{
										arr = domain.getOutLink().getValue().split(",");
									}
								%>
								<div class="right d_right">
									<%
										if(arr!=null)
										{
											for(int j=0;j<arr.length;j++)
											{
											%>
												<% if(!Utils.fomatDomain(arr[j]).trim().equals("")){ %><a href="/d/<%=Utils.fomatDomain(arr[j]) %>" ><%=Utils.fomatDomain(arr[j]) %></a> | <% } %>
											<%
											}
										}
										%>
								</div>
							</li>
						</ul>
					</div>		
					<%
					if(Integer.valueOf(domain.getAlexa()) < 110000)
					{
					%>
						<div class="list re_list">
							<h1 class="m_top">Domain Traffic Graph of <%=domain.getDomain() %></h1>
							<ul class="detail">
								<li>
									<div class="daily left">Daily Rank</div>
									<div class="daily right">Daily PageViews</div>
									<img class="left" src="http://traffic.alexa.com/graph?c=1&amp;u=<%=domain.getDomain() %>&amp;r=6m&amp;y=t&amp;z=3&amp;h=200&amp;w=280&amp;b=FFFFFF">
									<img class="right" src="http://traffic.alexa.com/graph?c=1&amp;u=<%=domain.getDomain() %>&amp;r=6m&amp;y=r&amp;z=3&amp;h=200&amp;w=280&amp;b=FFFFFF">
									<div class="clear"></div>
								</li>
							</ul>
						</div>	
					<%
					}
					%>	
					<%
					if(Integer.valueOf(domain.getAlexa()) < 1000000)
					{
					%>
					<div class="list re_list">
						<h1 class="m_top">Unique Visitors of <%=domain.getDomain() %></h1>
						<ul class="detail">
							<li  class="full">
								<img class="img_test" src="http://grapher.compete.com/<%=domain.getDomain() %>_uv_310.png">
							</li>
						</ul>
					</div>
					<%
					}
					%>
				</div>
			</div>
			<div class="clear"></div>
		</div>
<div id='opacity'></div>
<img src="/images/ajax-loader.gif" id='image_loadder'/>	
<script type="text/javascript">
	var domain = '<%=domain.getDomain()%>';
	
</script>	
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="/js/detail.js"></script>
<%@ include file='/layout/footer.jsp'%>		